package net.dgg.zz.credential.certificateType.controller;

import net.dgg.framework.tac.utils.bean.DggRestResponse;
import net.dgg.framework.tac.utils.web.commmon.DggBaseController;
import net.dgg.iboss.base.util.StringUtils;
import net.dgg.zz.credential.certificateType.service.CertificateTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

@RequestMapping("/zs/certificate_type")
@Controller
public class CertificateTypeController extends DggBaseController {
    @Autowired
    private CertificateTypeService certificateTypeService;

    /**
     * 查询资质类型、名称、等级
     *
     * @param params
     * @return
     */
    @RequestMapping("/get_certificate_type")
    @ResponseBody
    public DggRestResponse getCertificateType(@RequestParam Map params) {
        try {
            if (StringUtils.isEmpty((String) params.get("generalType"))){
                return this.getFailResponse("大类型(证书或资质)不能为空！");
            }
            List<Map> mapList = certificateTypeService.getCertificateType(params);
            return this.getSuccessResponse(mapList);
        } catch (Exception e) {
            return this.getFailResponse("操作失败，请联系管理员！");
        }

    }
}
